import router from './router'
import LocalStorage from "./model/localStorage"
import { Toast } from 'vant'

router.beforeEach((to, from, next) => {
    /**
     * 路由白名单
     */
    const whiteList =[""]
    Toast.loading({
        message: '加载中...',
        forbidClick: true,
        loadingType: 'spinner',
      })
    // alert(to.path)
    if (whiteList.indexOf(to.path) !== -1) {
        //白名单里没有 需要校验 token    
        next() 
    }else{
        // if(LocalStorage.get("token")){
        //    //https://www.cnblogs.com/sinosaurus/p/9016163.html
        //         next()
        // }
        
        next()
        // else{
        //     setTimeout(()=>{
        //         if(to.path ==="/login" || to.path ==="/register" || to.path ==="/password"){
        //             next()
        //         }else{
        //             next('/login')
        //         }
        //     },1000)
        // }
    }
})